\hypertarget{classdev_1_1net_1_1_tcp_connection}{}\section{dev\+:\+:net\+:\+:Tcp\+Connection Class Reference}
\label{classdev_1_1net_1_1_tcp_connection}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}


Tcp连接  




{\ttfamily \#include $<$Tcp\+Connection.\+hpp$>$}

Inheritance diagram for dev\+:\+:net\+:\+:Tcp\+Connection\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classdev_1_1net_1_1_tcp_connection}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_adfd3409480b496cc2ce2235c09545f0e}{}enum {\bfseries Status} \{ {\bfseries N\+O\+T\+C\+O\+N\+N\+E\+C\+T}, 
{\bfseries C\+O\+N\+N\+E\+C\+T}, 
{\bfseries C\+L\+O\+S\+I\+N\+G}, 
{\bfseries C\+L\+O\+S\+E\+D}
 \}\label{classdev_1_1net_1_1_tcp_connection_adfd3409480b496cc2ce2235c09545f0e}

\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a63c52320b0c3e1c174de09fe52592334}{}typedef boost\+::function$<$ void(\hyperlink{classdev_1_1net_1_1_tcp_connection}{Tcp\+Connection} \&)$>$ {\bfseries Pass\+Tcp\+Connection\+Ref\+C\+B}\label{classdev_1_1net_1_1_tcp_connection_a63c52320b0c3e1c174de09fe52592334}

\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_ad8b63353c7f4464ed5005b0e62acf929}{}typedef boost\+::function$<$ void(\hyperlink{classdev_1_1net_1_1_tcp_connection}{Tcp\+Connection} \&, \hyperlink{classdev_1_1net_1_1_tcp_connection_input_stream}{Tcp\+Connection\+Input\+Stream} \&)$>$ {\bfseries Input\+Tcp\+Message\+C\+B}\label{classdev_1_1net_1_1_tcp_connection_ad8b63353c7f4464ed5005b0e62acf929}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classdev_1_1net_1_1_tcp_connection_a43ee94855cd5bc5b46e5bb5b3fbb545c}{Tcp\+Connection} (sock\+\_\+t sock, size\+\_\+t is\+Size=1024 $\ast$32, size\+\_\+t os\+Size=1024 $\ast$32)
\begin{DoxyCompactList}\small\item\em Tcp连接构造函数 \end{DoxyCompactList}\item 
\hyperlink{classdev_1_1net_1_1_tcp_connection_aa63e6ea1c2b7e3280f9c0455cf97717e}{Tcp\+Connection} (sock\+\_\+t sock, boost\+::shared\+\_\+array$<$ char $>$ ibuff, boost\+::shared\+\_\+array$<$ char $>$ obuff, size\+\_\+t is\+Size, size\+\_\+t os\+Size)
\begin{DoxyCompactList}\small\item\em Tcp连接构造函数 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a7169d0396d8b3f9d3bc0bfa651c39f40}{}virtual void \hyperlink{classdev_1_1net_1_1_tcp_connection_a7169d0396d8b3f9d3bc0bfa651c39f40}{handle\+Input} (void)\label{classdev_1_1net_1_1_tcp_connection_a7169d0396d8b3f9d3bc0bfa651c39f40}

\begin{DoxyCompactList}\small\item\em 处理输入 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_ada4e4dc8bcdb148eef20a2b479697bbf}{}virtual void \hyperlink{classdev_1_1net_1_1_tcp_connection_ada4e4dc8bcdb148eef20a2b479697bbf}{handle\+Output} (void)\label{classdev_1_1net_1_1_tcp_connection_ada4e4dc8bcdb148eef20a2b479697bbf}

\begin{DoxyCompactList}\small\item\em 处理输出 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a5ad0a49140192c8fdd39c1f65b520009}{}virtual void \hyperlink{classdev_1_1net_1_1_tcp_connection_a5ad0a49140192c8fdd39c1f65b520009}{handle\+Exception} (void)\label{classdev_1_1net_1_1_tcp_connection_a5ad0a49140192c8fdd39c1f65b520009}

\begin{DoxyCompactList}\small\item\em 处理异常 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_ad5d67c0a60a1f2c9816e550e4f110e21}{}virtual void \hyperlink{classdev_1_1net_1_1_tcp_connection_ad5d67c0a60a1f2c9816e550e4f110e21}{handle\+Close} (void)\label{classdev_1_1net_1_1_tcp_connection_ad5d67c0a60a1f2c9816e550e4f110e21}

\begin{DoxyCompactList}\small\item\em 处理关闭(套接字从反应器移除) \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_aa932cbd22a8ecb67a9ecd386d45cf6a4}{}virtual void \hyperlink{classdev_1_1net_1_1_tcp_connection_aa932cbd22a8ecb67a9ecd386d45cf6a4}{handle\+Heart\+Beat} (void)\label{classdev_1_1net_1_1_tcp_connection_aa932cbd22a8ecb67a9ecd386d45cf6a4}

\begin{DoxyCompactList}\small\item\em 处理心跳 \end{DoxyCompactList}\item 
\hyperlink{classdev_1_1net_1_1_socket}{Socket} \& \hyperlink{classdev_1_1net_1_1_tcp_connection_a57fe0459b4df287e3bd350b219fe040a}{get\+Socket} (void)
\begin{DoxyCompactList}\small\item\em 获取连接套接字 \end{DoxyCompactList}\item 
\hyperlink{classdev_1_1net_1_1_tcp_connection_input_stream}{Tcp\+Connection\+Input\+Stream} \& \hyperlink{classdev_1_1net_1_1_tcp_connection_aa0a999f61e843d717c53a0601de5b6b6}{get\+Input\+Stream} (void)
\begin{DoxyCompactList}\small\item\em 获取连接输入流 \end{DoxyCompactList}\item 
\hyperlink{classdev_1_1net_1_1_tcp_connection_output_stream}{Tcp\+Connection\+Output\+Stream} \& \hyperlink{classdev_1_1net_1_1_tcp_connection_a65525b0c69eab1029c58b8313650c600}{get\+Output\+Stream} (void)
\begin{DoxyCompactList}\small\item\em 获取连接输出流 \end{DoxyCompactList}\item 
int \hyperlink{classdev_1_1net_1_1_tcp_connection_a03fe33106b2b3da08735374a73dc4577}{get\+Id} (void) const 
\begin{DoxyCompactList}\small\item\em 获取连接\+I\+D \end{DoxyCompactList}\item 
\hyperlink{classdev_1_1net_1_1_event_loop}{Event\+Loop} $\ast$ \hyperlink{classdev_1_1net_1_1_tcp_connection_a00d25aa9a45d083c8687cb21b9ddc749}{get\+Loop} (void) const 
\begin{DoxyCompactList}\small\item\em 获取连接绑定到的事件循环 \end{DoxyCompactList}\item 
Status \hyperlink{classdev_1_1net_1_1_tcp_connection_afe7aa2706938bd73520494664c7527f5}{get\+Status} (void) const 
\begin{DoxyCompactList}\small\item\em 获取连接状态 \end{DoxyCompactList}\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a61f65d30aed34c170e355ce5841dc1d3}{}void \hyperlink{classdev_1_1net_1_1_tcp_connection_a61f65d30aed34c170e355ce5841dc1d3}{shutdown} (void)\label{classdev_1_1net_1_1_tcp_connection_a61f65d30aed34c170e355ce5841dc1d3}

\begin{DoxyCompactList}\small\item\em 关闭连接 \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a810e9e3048210a2e29dbd5cdd6f5812d}{}class {\bfseries Tcp\+Acceptor}\label{classdev_1_1net_1_1_tcp_connection_a810e9e3048210a2e29dbd5cdd6f5812d}

\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a0736aba6eec2f2c2a13494228473b67c}{}class {\bfseries Tcp\+Worker}\label{classdev_1_1net_1_1_tcp_connection_a0736aba6eec2f2c2a13494228473b67c}

\item 
\hypertarget{classdev_1_1net_1_1_tcp_connection_a3ecf3132e8c4bf890c07853cfab7619c}{}class {\bfseries Tcp\+Server}\label{classdev_1_1net_1_1_tcp_connection_a3ecf3132e8c4bf890c07853cfab7619c}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Tcp连接 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classdev_1_1net_1_1_tcp_connection_a43ee94855cd5bc5b46e5bb5b3fbb545c}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!Tcp\+Connection@{Tcp\+Connection}}
\index{Tcp\+Connection@{Tcp\+Connection}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{Tcp\+Connection(sock\+\_\+t sock, size\+\_\+t is\+Size=1024 $\ast$32, size\+\_\+t os\+Size=1024 $\ast$32)}]{\setlength{\rightskip}{0pt plus 5cm}Tcp\+Connection\+::\+Tcp\+Connection (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{size\+\_\+t}]{is\+Size = {\ttfamily 1024~$\ast$~32}, }
\item[{size\+\_\+t}]{os\+Size = {\ttfamily 1024~$\ast$~32}}
\end{DoxyParamCaption}
)}\label{classdev_1_1net_1_1_tcp_connection_a43ee94855cd5bc5b46e5bb5b3fbb545c}


Tcp连接构造函数 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em is\+Size} & 输入流缓存大小 \\
\hline
{\em os\+Size} & 输出流缓存大小 \\
\hline
\end{DoxyParams}
\hypertarget{classdev_1_1net_1_1_tcp_connection_aa63e6ea1c2b7e3280f9c0455cf97717e}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!Tcp\+Connection@{Tcp\+Connection}}
\index{Tcp\+Connection@{Tcp\+Connection}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{Tcp\+Connection(sock\+\_\+t sock, boost\+::shared\+\_\+array$<$ char $>$ ibuff, boost\+::shared\+\_\+array$<$ char $>$ obuff, size\+\_\+t is\+Size, size\+\_\+t os\+Size)}]{\setlength{\rightskip}{0pt plus 5cm}Tcp\+Connection\+::\+Tcp\+Connection (
\begin{DoxyParamCaption}
\item[{sock\+\_\+t}]{sock, }
\item[{boost\+::shared\+\_\+array$<$ char $>$}]{ibuff, }
\item[{boost\+::shared\+\_\+array$<$ char $>$}]{obuff, }
\item[{size\+\_\+t}]{is\+Size, }
\item[{size\+\_\+t}]{os\+Size}
\end{DoxyParamCaption}
)}\label{classdev_1_1net_1_1_tcp_connection_aa63e6ea1c2b7e3280f9c0455cf97717e}


Tcp连接构造函数 


\begin{DoxyParams}{Parameters}
{\em sock} & 本地套接字 \\
\hline
{\em ibuff} & 在外部申请的输入流缓存，其大小必须等于is\+Size \\
\hline
{\em os\+Size} & 在外部申请的输出流缓存，其大小必须等于os\+Size \\
\hline
{\em is\+Size} & 输入流缓存大小 \\
\hline
{\em os\+Size} & 输出流缓存大小 \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classdev_1_1net_1_1_tcp_connection_a03fe33106b2b3da08735374a73dc4577}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Id@{get\+Id}}
\index{get\+Id@{get\+Id}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Id(void) const }]{\setlength{\rightskip}{0pt plus 5cm}int dev\+::net\+::\+Tcp\+Connection\+::get\+Id (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_a03fe33106b2b3da08735374a73dc4577}


获取连接\+I\+D 

\begin{DoxyReturn}{Returns}
int 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_tcp_connection_aa0a999f61e843d717c53a0601de5b6b6}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Input\+Stream@{get\+Input\+Stream}}
\index{get\+Input\+Stream@{get\+Input\+Stream}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Input\+Stream(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Tcp\+Connection\+Input\+Stream}\& dev\+::net\+::\+Tcp\+Connection\+::get\+Input\+Stream (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_aa0a999f61e843d717c53a0601de5b6b6}


获取连接输入流 

\begin{DoxyReturn}{Returns}
\hyperlink{classdev_1_1net_1_1_tcp_connection_input_stream}{Tcp\+Connection\+Input\+Stream}\& 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_tcp_connection_a00d25aa9a45d083c8687cb21b9ddc749}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Loop@{get\+Loop}}
\index{get\+Loop@{get\+Loop}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Loop(void) const }]{\setlength{\rightskip}{0pt plus 5cm}{\bf Event\+Loop}$\ast$ dev\+::net\+::\+Tcp\+Connection\+::get\+Loop (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_a00d25aa9a45d083c8687cb21b9ddc749}


获取连接绑定到的事件循环 

\begin{DoxyReturn}{Returns}
Event\+Loop$\ast$ 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_tcp_connection_a65525b0c69eab1029c58b8313650c600}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Output\+Stream@{get\+Output\+Stream}}
\index{get\+Output\+Stream@{get\+Output\+Stream}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Output\+Stream(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Tcp\+Connection\+Output\+Stream}\& dev\+::net\+::\+Tcp\+Connection\+::get\+Output\+Stream (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_a65525b0c69eab1029c58b8313650c600}


获取连接输出流 

\begin{DoxyReturn}{Returns}
\hyperlink{classdev_1_1net_1_1_tcp_connection_output_stream}{Tcp\+Connection\+Output\+Stream}\& 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_tcp_connection_a57fe0459b4df287e3bd350b219fe040a}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Socket@{get\+Socket}}
\index{get\+Socket@{get\+Socket}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Socket(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Socket}\& dev\+::net\+::\+Tcp\+Connection\+::get\+Socket (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_a57fe0459b4df287e3bd350b219fe040a}


获取连接套接字 

\begin{DoxyReturn}{Returns}
\hyperlink{classdev_1_1net_1_1_socket}{Socket}\& 
\end{DoxyReturn}
\hypertarget{classdev_1_1net_1_1_tcp_connection_afe7aa2706938bd73520494664c7527f5}{}\index{dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}!get\+Status@{get\+Status}}
\index{get\+Status@{get\+Status}!dev\+::net\+::\+Tcp\+Connection@{dev\+::net\+::\+Tcp\+Connection}}
\subsubsection[{get\+Status(void) const }]{\setlength{\rightskip}{0pt plus 5cm}Status dev\+::net\+::\+Tcp\+Connection\+::get\+Status (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classdev_1_1net_1_1_tcp_connection_afe7aa2706938bd73520494664c7527f5}


获取连接状态 

\begin{DoxyReturn}{Returns}
Status 
\end{DoxyReturn}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
dev/dev/net/Tcp\+Connection.\+hpp\item 
dev/src/net/Tcp\+Connection.\+cpp\end{DoxyCompactItemize}
